package contratosonline.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author admin
 */
@Entity
@Table(name = "campus", schema = "contratos")
@NamedQueries({@NamedQuery(name = "Campus.findAll", query = "SELECT c FROM Campus c"), @NamedQuery(name = "Campus.findByIdCampus", query = "SELECT c FROM Campus c WHERE c.idCampus = :idCampus"), @NamedQuery(name = "Campus.findByNomeCampus", query = "SELECT c FROM Campus c WHERE c.nomeCampus = :nomeCampus")})
public class Campus implements Serializable {
    private static final long serialVersionUID = 2L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "idCampus")
    private Integer idCampus;
    @Basic(optional = false)
    @Column(name = "nomeCampus")
    private String nomeCampus;
    @OneToMany(mappedBy = "campus", fetch = FetchType.EAGER)
    private Collection<Setor> setorCollection;

    public Campus() {
    }

    public Campus(Integer idCampus) {
        this.idCampus = idCampus;
    }

    public Campus(Integer idCampus, String nomeCampus) {
        this.idCampus = idCampus;
        this.nomeCampus = nomeCampus;
    }

    public Integer getIdCampus() {
        return idCampus;
    }

    public void setIdCampus(Integer idCampus) {
        this.idCampus = idCampus;
    }

    public String getNomeCampus() {
        return nomeCampus;
    }

    public void setNomeCampus(String nomeCampus) {
        this.nomeCampus = nomeCampus;
    }

    public Collection<Setor> getSetorCollection() {
        return setorCollection;
    }

    public void setSetorCollection(Collection<Setor> setorCollection) {
        this.setorCollection = setorCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCampus != null ? idCampus.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Campus)) {
            return false;
        }
        Campus other = (Campus) object;
        if ((this.idCampus == null && other.idCampus != null) || (this.idCampus != null && !this.idCampus.equals(other.idCampus))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "contratosonline.entity.Campus[idCampus=" + idCampus + "]";
    }

}
